/****************************************************************************/      
/* NAME:           Hal_OutputManagement.h                                   */      
/* PURPOSE:        Manage all basic output                                  */      
/* CREATED_BY:     Vyx                                                      */      
/* CREATION_DATE:  03/07/2012                                               */   
/************************************** (C) Copyright 2012 AquaLink *********/   

#ifndef OUTPUT_MANAGEMENT_DEF
#define OUTPUT_MANAGEMENT_DEF

#include "Hal_GenericConfig.h"
#include "stm32f10x.h"
#include "stm32_config.h"
#include "main.h"

/* OutputName                    */
/* Add your output in this table */

#ifdef STM32_CONFIG_1 /* STM32_CONFIG_1 */

    #define OSMOLATOR_PUMP   0
    #define LIGHT_OUT_1      1
    #define LIGHT_OUT_2      2
    #define LIGHT_OUT_3      3
    #define LIGHT_OUT_4      4 
    #define LIGHT_OUT_5      5
    #define LIGHT_OUT_6      6
    #define OSCILLATOR_OUT_1 7
    #define OSCILLATOR_OUT_2 8
    #define USART_1_RX       9
    #define LED_BLUE_1       10
    #define SPI_CS           11
    #define SPI_SCK          12
    #define SPI_MISO         13
    #define SPI_MOSI         14

#endif /* STM32_CONFIG_1 */

#ifdef STM32_CONFIG_2 /* STM32_CONFIG_2 */

    #define OSMOLATOR_PUMP   0
    #define LIGHT_OUT_1      1
    #define LIGHT_OUT_2      2
    #define LIGHT_OUT_3      3
    #define LIGHT_OUT_4      4 
    #define LIGHT_OUT_5      5
    #define LIGHT_OUT_6      6
    #define OSCILLATOR_OUT_1 7
    #define OSCILLATOR_OUT_2 8
    #define USART_1_RX       9
    #define LED_BLUE_1       10
    #define SPI_CS           11
    #define SPI_SCK          12
    #define SPI_MISO         13
    #define SPI_MOSI         14
    #define LEDSPWM_1        15
    #define LEDSPWM_2        16
    #define LEDSPWM_3        17
    #define LEDSPWM_4        18
    #define LEDSPWM_5        19
    #define LEDSPWM_6        20
    #define LEDSPWM_7        21

#endif /* STM32_CONFIG_2 */

typedef struct
{
  GPIO_TypeDef     *OutputGpio;
  uint16_t          OutputPin;
  GPIOMode_TypeDef  OutputMode;
}Output_def_t;

/**    
  * @brief  Main function of output management.  
  *         This function is execute one time at the start.
  * @param  none    
  * @retval None    
  */  
void vTaskCTRL_OutputManagementInit(void);

/**    
  * @brief  Get the value of selected output.    
  * @param  Name of output 
  * @retval Value of output (TRUE or FALSE)
  */  
bool OUTPUT_GetOutputValue(uint8_t OutputName);

/**    
  * @brief  Set the value of selected output.    
  * @param  Name of output 
  * @retval Value of output (TRUE or FALSE)
  */  
void OUTPUT_SetOutputValue(uint8_t OutputName, bool OutputValue);

#endif /* OUTPUT_MANAGEMENT_DEF */
